package com.seamtop.cuber.web.auth;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

public class AuthInterceptor extends HandlerInterceptorAdapter {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        boolean flag = true;
//        String path = request.getRequestURL().toString();
//        if(path.endsWith(".shtml") || path.endsWith(".action")){
//            if(path.contains("login") || path.contains("error")){
//                flag =  true;
//            }else{
//                Object obj = request.getSession().getAttribute("loginedUser");
//                if (obj != null) {
//                    flag = true;
//                }else{
//                    flag = false;
//                }
//            }//

//            if(flag == false){
//                response.sendRedirect("/login/index.shtml");
//            }
//        }
        return flag;
    }
}